var net = require('net');
var PORT = 3001;
var HOSt = '127.0.0.1';

// tcp客户端
var client = net.createConnection(PORT, HOST)

client.on('connect', () => {
    console.log('已与服务端建立连接')
})
client.on('data', function (data) {
    console.log('收到服务端数据，内容为' + data)
})
client.on('close', () => {
    console.log('断开')
})
client.on('end', () => {
    console.log('连接断开')
})